package com.nassir.chatroom.test;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class Window extends JFrame implements ActionListener {
	JTextField text = new JTextField(10);
	JButton button = new JButton("确定");
	JLabel label = new JLabel("帐号");

	public Window() {
		init();
		setBounds(500, 200, 200, 200);
		setVisible(true);
		setDefaultCloseOperation(HIDE_ON_CLOSE);
	}

	public void init() {
		setLayout(new FlowLayout());
		add(label);
		add(text);
		add(button);
		button.addActionListener(this);
	}

	public void actionPerformed(ActionEvent e) {
		String id = text.getText();
		this.setVisible(false);
		Window2 win = new Window2(id);// 就是通过这个Id传进去的，window2里的构造函数的参数
	}
}